<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>市长-城市信息表</title>
</head>
<body>

<h3>搜索市长</h3>
<form th:action="@{/mayorlist}" method="post">
    用户名：<input type="text" name="name"><br>
    <input type="submit" value="搜索">
</form>

<div><a th:href="@{/addmayor}">添加市长信息</a></div>

<table border="1">
    <tr>
        <th>城市编号</th>
        <th>城市名称</th>
        <th>城市面积</th>
        <th>城市人口</th>
        <th>市长姓名</th>
        <th>市长年龄</th>
        <th>市长性别</th>
        <th>市长电话</th>
        <th>删除信息</th>
        <th>修改信息</th>
    </tr>
    <tr th:each="mayor:${list}">
        <td th:text="${mayor.cid}"></td>
        <td th:text="${mayor.city.cname}"></td>
        <td th:text="${mayor.city.carea}"></td>
        <td th:text="${mayor.city.cpopulation}"></td>
        <td th:text="${mayor.mname}"></td>
        <td th:text="${mayor.mage}"></td>
        <td th:text="${mayor.mgender}"></td>
        <td th:text="${mayor.mtel}"></td>
        <td>
            <a th:href="@{'/deleteMayorById?cid='+${mayor.cid}}">删除</a>
        </td>
        <td>
            <a th:href="@{/updateMayorCity(cid=${mayor.cid},mgender=${mayor.mgender},mtel=${mayor.mtel},
                                       mage=${mayor.mage},mname=${mayor.mname},cname=${mayor.city.cname},
                                       carea=${mayor.city.carea},cpopulation=${mayor.city.cpopulation},
                                       )}">修改</a>
        </td>
    </tr>

</table>
</body>
<style>
    a {
        text-decoration: none;
    }

</style>
</html>